{extend name="base/index"/} 
{block name="page_location"}
<div class="row">
	<div class="col-12">
		<div class="page-title-box">
			<div class="page-title-right">
				<ol class="breadcrumb m-0">
					<li class="breadcrumb-item"><a href="{:url('index/index')}">管理中心</a></li>
					<li class="breadcrumb-item active"><i class="iconfont icon-angle-right"></i>后台菜单管理</li>
				</ol>
			</div>
			<h4 class="page-title">
				所有后台菜单
			</h4>
		</div>
	</div>
</div>
<!-- END PAGE TITLE & BREADCRUMB-->
{/block} 
{block name="body"}
<div class="row" id="menu_page">
	<div class="col-12">
		<div class="card">
			<div class="card-body">
				<p>
				<a href="javascript:;" class="btn btn-success btn-sm" data-toggle="modal" data-target="#edit_box" id="add_menu_btn">创建新的管理菜单</a>
				<a href="javascript:;" class="btn btn-primary btn-sm" id="Fast_Sort" attr-model="menu">更新排序</a>					
				</p>
				<form action="" method="post" id="menu_list_frm">
					<table class="table table-centered mb-0">
						<thead>
							<tr>
								<th>ID</th>
								<th>菜单名称</th>
								<th>菜单图标</th>
								<th>菜单URL</th>
								<th>菜单排序</th>
								<th>左侧显示</th>
								<th>创建时间</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							{volist name='list' id="data"}
							<tr>
								<td>{$data.id}</td>
								<td>{$data.menu_name}</td>
								<td>{$data.menu_icon}</td>
								<td>{$data.menu_url}</td>
								<td>
									<input type="hidden" name="field_ids[]" value="{$data.id}" />
									<input type="number" class="form-control orderid_ipt" name="orderid_ipt[]" value="{$data.orderid}">
								</td>
								<td>
									{eq name="data.isshow" value="1"}
									<a href="javascript:;" attr-model="menu" attr-id="{$data.id}" attr-field="isshow" attr-val="0" class="badge badge-primary Fast_Action">显示</a>
									{else /}
									<a href="javascript:;" attr-model="menu" attr-id="{$data.id}" attr-field="isshow" attr-val="1" class="badge badge-secondary Fast_Action">不显示</a>
									{/eq}
								</td>
								<td><span class="badge badge-primary">{$data.posttime|date="Y-m-d H:i",###}</span></td>
								<td>
									<a href="javascript:;" class="btn btn-primary btn-sm edit_btn" data-toggle="modal" attr-id="{$data.id}" data-target="#edit_box"><i class="iconfont icon-icon_compile"></i> 修改</a>
									<a href="javascript:;" attr-id="{$data.id}" class="btn btn-danger btn-sm Fast_Del" attr-model="menu"><i class="iconfont icon-icon_delete_fill"></i> 删除</a>
								</td>
							</tr>
							{volist name="data['menu_list']" id="sdata"}
							<tr>
								<td>{$sdata.id}</td>
								<td class="pleft40"><span class="subtype_indent link">&nbsp;&nbsp;├</span>&nbsp;&nbsp;{$sdata.menu_name}</td>
								<td>{$sdata.menu_icon}</td>
								<td>{$sdata.menu_url}</td>
								<td>
									<input type="hidden" name="field_ids[]" value="{$sdata.id}" />
									<input type="number" class="form-control orderid_ipt" name="orderid_ipt[]" value="{$sdata.orderid}">
								</td>
								<td>
									{eq name="sdata.isshow" value="1"}
									<a href="javascript:;" attr-model="menu" attr-id="{$sdata.id}" attr-field="isshow" attr-val="0" class="badge badge-primary Fast_Action">显示</a>
									{else /}
									<a href="javascript:;" attr-model="menu" attr-id="{$sdata.id}" attr-field="isshow" attr-val="1" class="badge badge-secondary Fast_Action">不显示</a>
									{/eq}
								</td>
								<td><span class="badge badge-primary">{$data.posttime|date="Y-m-d H:i",###}</span></td>
								<td>
									<a href="javascript:;" class="btn btn-primary btn-sm edit_btn" data-toggle="modal" attr-id="{$sdata.id}" data-target="#edit_box"><i class="iconfont icon-icon_compile"></i> 修改</a>
									<a href="javascript:;" attr-id="{$sdata.id}" class="btn btn-danger btn-sm Fast_Del" attr-model="menu"><i class="iconfont icon-icon_delete_fill"></i> 删除</a>
								</td>
							</tr>
							{/volist} 
						{/volist}
						</tbody>
					</table>
				</form>	
				<div class="row">
					<div class="col-12" style="text-align: center;">
						{$pagelist}
					</div>
				</div>				
			</div>
		</div>
	</div>

{/block} 
{block name="modal_dig"}
<!-- Modal -->
<div class="modal fade" id="edit_box" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-full-700">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title dig_title" id="myModalLabel">修改菜单信息</h4>
				<button type="button" class="close" data-dismiss="modal">x</button>
			</div>
			<div class="modal-body">
				<form action="#" class="form-horizontal" id="edit_node_frm">
					<input type="hidden" name="id" value="">
					<div class="form-group row mb-1">
						<label class="col-3 col-form-label">主分类：</label>
						<div class="col-5">
							<select class="form-control" tabindex="1" name="menu_pid">
								<option value="0">请选择所属主分类</option>
								{volist name='list' id="data"}
								<option value="{$data.id}">{$data.menu_name}</option>
								{/volist}
							</select>
						</div>
					</div>
					<div class="form-group row mb-1">
						<label class="col-3 col-form-label">菜单名称：</label>
						<div class="col-5">
							<input type="text" placeholder="请输入中文的菜单名称" name="menu_name" class="form-control ipt_check"  data-type="string" data-len="1-10" nullmsg="菜单名称不能为空" errormsg="菜单名称只能由1-10位的字符组成">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>							
					</div>
					<div class="form-group row mb-1">
						<label class="col-3 col-form-label">菜单图标：</label>
						<div class="col-5">
							<input type="text" name="menu_icon" placeholder="请选择菜单的图标class" class="form-control" id="edit_icon" value="" readonly="readonly">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted"><a class="btn btn-primary btn-sm select_icon_box" attr-id="#edit_icon" href="javascript:;">选择图标</a></span>
						</div>							
					</div>
					<div class="form-group row mb-1">
						<label class="col-3 col-form-label">菜单排序：</label>
						<div class="col-5">
							<input type="text" name="orderid" placeholder="" class="form-control" value="">
						</div>
						
					</div>
					<div class="form-group row mb-1">
						<label class="col-3 col-form-label">菜单地址：</label>
						<div class="col-5">
							<input type="text" placeholder="请输入英文的菜单地址" name="menu_url" class="form-control ">
						</div>
						<div class="col-2">
							<span class="font-13 text-muted">必填</span>
						</div>	
					</div>
					<div class="form-group row mb-1">
						<label class="col-3 col-form-label">左侧显示：</label>
						<div class="col-5">
							<div class="custom-control custom-radio">
								<input type="radio" name="isshow" id="isshow1" class="custom-control-input" value="0" checked="checked">
								<label class="custom-control-label" for="isshow1">不显示</label>
							</div>
							<div class="custom-control custom-radio">
								<input type="radio" name="isshow" id="isshow2" class="custom-control-input" value="1">
								<label class="custom-control-label" for="isshow2">显示</label>
							</div>
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
				<button type="button" class="btn btn-primary Fast_Form_Post" attr-frm="#edit_node_frm" attr-callback="reload" attr-model="menu" attr-active="save_node"><i class="icon-ok"></i> 立即提交</button>
			</div>
		</div>
	</div>
</div>
<div class="modal-body"  id="select_icon_box" style="background-color: #FFF;display: none;width:850px;">
	<input type="hidden" id="setinputid" value="" />
	<ul class="icon_list">
		{volist name="icon_list" id="icon"}
			<li><a href="javascript:;" attr-icon="{$icon.classname}"><span class="iconfont {$icon.classname}"></span></a></li>
		{/volist}
	</ul>
</div>  
{/block}